package com.credithc.customers.base.ro;

import com.credithc.customers.base.codes.CustomerCodes;
import com.credithc.customers.base.exception.CustomerException;
import com.credithc.customers.base.utils.CustomerUtils;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

/**
 * @description: 【后端授权】授权
 * @author: dhx
 * @date: 2019/7/8 15:47
 * @param: null
 * @return:
 */
@Data
public class UnifyAuthRo extends CustomerBaseRo {

    private String requestNo;

    private String preCustomerNo;

    private String authSystem;

    private String authSubSystem;

    private String sourceType;

    public static void checkBaseParam(UnifyAuthRo ro) {
        CustomerUtils.checkRequestNo(ro.getRequestNo());
        CustomerUtils.checkPreCustomerNo(ro.getPreCustomerNo());
        if (StringUtils.isBlank(ro.getAuthSystem())) {
            throw new CustomerException(CustomerCodes.PARAM_VALIDATE_ERROR, "authSystem不能为空");
        }
        if (StringUtils.isBlank(ro.getAuthSubSystem())) {
            throw new CustomerException(CustomerCodes.PARAM_VALIDATE_ERROR, "authSubSystem不能为空");
        }
    }
}
